package map.beans;

import java.io.Serializable;
import java.util.Map;

import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name="ENGINES")
@NamedQueries({ 
	@NamedQuery(name = "Engine.findAll", 			query = "SELECT e FROM MapEngineRegistrationBean e"),
	@NamedQuery(name = "Engine.exists",  			query = "SELECT COUNT (e) FROM MapEngineRegistrationBean e WHERE e.name = :name"),
	@NamedQuery(name = "Engine.getByEngineName",  	query = "SELECT e FROM MapEngineRegistrationBean e WHERE e.name = :name")
})
public class MapEngineRegistrationBean implements Serializable {
	private static final long serialVersionUID = -8601458142732724579L;
	@Id
	@GeneratedValue
	private Long id;
	private String name;
	private String url;
	@ElementCollection(fetch = FetchType.EAGER)
	Map<String, String> properties;

	public MapEngineRegistrationBean() {
		super();
	}

	public MapEngineRegistrationBean(Long id, String name, String url, Map<String, String> properties) {
		super();
		this.id = id;
		this.name = name;
		this.url = url;
		this.properties = properties;
	}

	public Map<String, String> getProperties() {
		return properties;
	}

	public void setProperties(Map<String, String> properties) {
		this.properties = properties;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param url
	 *            the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}
}
